+Sat Dec 19 05:37:51 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.c (gtk_label_expose): removed return_if_fail
+ (label->words != NULL) since that's a valid case when the label
+ is empty, or just default constructed.
+ fixed indentation prototype arguments and braces in some places.
+ also, pointer comparisions and initializations are done with NULL
+ not 0, there's a reason GLib defines NULL.
+
+ * gdk/gdkevents.c (gdk_events_pending): return (queued_events ||
+ putback_events) so this again returns whether events are pending,
+ not whether other sources like idles are pending.
+
+ * gtk/gtkmain.c (gtk_main_iteration_do):
+ (gtk_main_iteration): return whether the loop is done, not whether
+ something got dispatch to restore the original behaviour (yosh: this
+ fixes code like in GleSelector).
+
Fri Dec 18 19:20:45 PST 1998 Manish Singh <yosh@gimp.org>
* gtkbutton.[ch]
+Sat Dec 19 05:37:51 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.c (gtk_label_expose): removed return_if_fail
+ (label->words != NULL) since that's a valid case when the label
+ is empty, or just default constructed.
+ fixed indentation prototype arguments and braces in some places.
+ also, pointer comparisions and initializations are done with NULL
+ not 0, there's a reason GLib defines NULL.
+
+ * gdk/gdkevents.c (gdk_events_pending): return (queued_events ||
+ putback_events) so this again returns whether events are pending,
+ not whether other sources like idles are pending.
+
+ * gtk/gtkmain.c (gtk_main_iteration_do):
+ (gtk_main_iteration): return whether the loop is done, not whether
+ something got dispatch to restore the original behaviour (yosh: this
+ fixes code like in GleSelector).
+
Fri Dec 18 19:20:45 PST 1998 Manish Singh <yosh@gimp.org>
* gtkbutton.[ch]
+Sat Dec 19 05:37:51 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.c (gtk_label_expose): removed return_if_fail
+ (label->words != NULL) since that's a valid case when the label
+ is empty, or just default constructed.
+ fixed indentation prototype arguments and braces in some places.
+ also, pointer comparisions and initializations are done with NULL
+ not 0, there's a reason GLib defines NULL.
+
+ * gdk/gdkevents.c (gdk_events_pending): return (queued_events ||
+ putback_events) so this again returns whether events are pending,
+ not whether other sources like idles are pending.
+
+ * gtk/gtkmain.c (gtk_main_iteration_do):
+ (gtk_main_iteration): return whether the loop is done, not whether
+ something got dispatch to restore the original behaviour (yosh: this
+ fixes code like in GleSelector).
+
Fri Dec 18 19:20:45 PST 1998 Manish Singh <yosh@gimp.org>
* gtkbutton.[ch]
+Sat Dec 19 05:37:51 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.c (gtk_label_expose): removed return_if_fail
+ (label->words != NULL) since that's a valid case when the label
+ is empty, or just default constructed.
+ fixed indentation prototype arguments and braces in some places.
+ also, pointer comparisions and initializations are done with NULL
+ not 0, there's a reason GLib defines NULL.
+
+ * gdk/gdkevents.c (gdk_events_pending): return (queued_events ||
+ putback_events) so this again returns whether events are pending,
+ not whether other sources like idles are pending.
+
+ * gtk/gtkmain.c (gtk_main_iteration_do):
+ (gtk_main_iteration): return whether the loop is done, not whether
+ something got dispatch to restore the original behaviour (yosh: this
+ fixes code like in GleSelector).
+
Fri Dec 18 19:20:45 PST 1998 Manish Singh <yosh@gimp.org>
* gtkbutton.[ch]
+Sat Dec 19 05:37:51 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.c (gtk_label_expose): removed return_if_fail
+ (label->words != NULL) since that's a valid case when the label
+ is empty, or just default constructed.
+ fixed indentation prototype arguments and braces in some places.
+ also, pointer comparisions and initializations are done with NULL
+ not 0, there's a reason GLib defines NULL.
+
+ * gdk/gdkevents.c (gdk_events_pending): return (queued_events ||
+ putback_events) so this again returns whether events are pending,
+ not whether other sources like idles are pending.
+
+ * gtk/gtkmain.c (gtk_main_iteration_do):
+ (gtk_main_iteration): return whether the loop is done, not whether
+ something got dispatch to restore the original behaviour (yosh: this
+ fixes code like in GleSelector).
+
Fri Dec 18 19:20:45 PST 1998 Manish Singh <yosh@gimp.org>
* gtkbutton.[ch]
+Sat Dec 19 05:37:51 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.c (gtk_label_expose): removed return_if_fail
+ (label->words != NULL) since that's a valid case when the label
+ is empty, or just default constructed.
+ fixed indentation prototype arguments and braces in some places.
+ also, pointer comparisions and initializations are done with NULL
+ not 0, there's a reason GLib defines NULL.
+
+ * gdk/gdkevents.c (gdk_events_pending): return (queued_events ||
+ putback_events) so this again returns whether events are pending,
+ not whether other sources like idles are pending.
+
+ * gtk/gtkmain.c (gtk_main_iteration_do):
+ (gtk_main_iteration): return whether the loop is done, not whether
+ something got dispatch to restore the original behaviour (yosh: this
+ fixes code like in GleSelector).
+
Fri Dec 18 19:20:45 PST 1998 Manish Singh <yosh@gimp.org>
* gtkbutton.[ch]
+Sat Dec 19 05:37:51 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.c (gtk_label_expose): removed return_if_fail
+ (label->words != NULL) since that's a valid case when the label
+ is empty, or just default constructed.
+ fixed indentation prototype arguments and braces in some places.
+ also, pointer comparisions and initializations are done with NULL
+ not 0, there's a reason GLib defines NULL.
+
+ * gdk/gdkevents.c (gdk_events_pending): return (queued_events ||
+ putback_events) so this again returns whether events are pending,
+ not whether other sources like idles are pending.
+
+ * gtk/gtkmain.c (gtk_main_iteration_do):
+ (gtk_main_iteration): return whether the loop is done, not whether
+ something got dispatch to restore the original behaviour (yosh: this
+ fixes code like in GleSelector).
+
Fri Dec 18 19:20:45 PST 1998 Manish Singh <yosh@gimp.org>
* gtkbutton.[ch]
gint
gdk_events_pending (void)
{
- return g_main_pending();
+ return (queued_events || putback_events);
}
/*
gint
gdk_events_pending (void)
{
- return g_main_pending();
+ return (queued_events || putback_events);
}
/*
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
}
-static GtkLabelWord *
+static GtkLabelWord*
gtk_label_word_alloc ()
{
GtkLabelWord * word;
}
static void
-gtk_label_free_words (GtkLabel * label)
+gtk_label_free_words (GtkLabel *label)
{
GtkLabelWord * last;
gtk_label_free_ulines (label->words);
last->next = free_words;
free_words = label->words;
- label->words = 0;
+ label->words = NULL;
}
}
-static GtkLabelULine *
-gtk_label_uline_alloc ()
+static GtkLabelULine*
+gtk_label_uline_alloc (void)
{
GtkLabelULine * uline;
uline = g_mem_chunk_alloc (uline_chunk);
}
- uline->next = 0;
+ uline->next = NULL;
+
return uline;
}
word->uline = 0;
}
}
-
+
static gint
-gtk_label_split_text (GtkLabel * label)
+gtk_label_split_text (GtkLabel *label)
{
GtkLabelWord *word, **tailp;
gint space_width, line_width, max_line_width;
GdkWChar *str, *p;
- g_return_val_if_fail (GTK_WIDGET (label)->style->font != 0, 0);
-
+ g_return_val_if_fail (GTK_WIDGET (label)->style->font != NULL, 0);
+
gtk_label_free_words (label);
- if (label->label == 0)
- return 0;
+ if (label->label == NULL)
+ return 0;
- /*
- * Split text at new-lines.
- */
+ /* Split text at new-lines. */
space_width = gdk_string_width (GTK_WIDGET (label)->style->font, " ");
-
+
line_width = 0;
max_line_width = 0;
tailp = &label->words;
while (*str)
{
word = gtk_label_word_alloc ();
-
- if ((str == label->label_wc) || (str[-1] == '\n'))
+
+ if (str == label->label_wc || str[-1] == '\n')
{
/* Paragraph break */
word->space = 0;
-
+
max_line_width = MAX (line_width, max_line_width);
line_width = 0;
}
/* Regular inter-word space */
word->space = space_width;
}
-
+
word->beginning = str;
word->length = 0;
p = word->beginning;
- while (*p && (*p != '\n'))
+ while (*p && *p != '\n')
{
word->length++;
p++;
}
-
+
word->width = gdk_text_width_wc (GTK_WIDGET (label)->style->font, str, word->length);
-
+
str += word->length;
if (*str)
- str++;
+ str++;
line_width += word->space + word->width;
-
+
*tailp = word;
tailp = &word->next;
}
-
+
return MAX (line_width, max_line_width);
}
static gint
-gtk_label_split_text_wrapped (GtkLabel * label)
+gtk_label_split_text_wrapped (GtkLabel *label)
{
/* this needs to handle white space better. */
GtkLabelWord *word, **tailp;
gint space_width, line_width, max_line_width;
GdkWChar *str, *p;
- g_return_val_if_fail (GTK_WIDGET (label)->style->font != 0, 0);
-
+ g_return_val_if_fail (GTK_WIDGET (label)->style->font != NULL, 0);
+
gtk_label_free_words (label);
- if (label->label == 0)
- return 0;
+ if (label->label == NULL)
+ return 0;
- /*
- * Split text at new-lines. (Or at spaces in the case of paragraphs).
- */
+ /* Split text at new-lines. (Or at spaces in the case of paragraphs). */
space_width = gdk_string_width (GTK_WIDGET (label)->style->font, " ");
-
+
line_width = 0;
max_line_width = 0;
tailp = &label->words;
while (*str)
{
word = gtk_label_word_alloc ();
-
+
if (str == label->label_wc || str[-1] == '\n')
{
/* Paragraph break */
word->space = 0;
-
+
max_line_width = MAX (line_width, max_line_width);
line_width = 0;
}
else if (str[0] == ' ')
{
gint nspaces = 0;
-
+
while (str[0] == ' ')
{
nspaces++;
str++;
}
-
+
if (label->jtype == GTK_JUSTIFY_FILL)
word->space = (space_width * 3 + 1) / 2;
else
/* Regular inter-word space */
word->space = space_width;
}
-
+
word->beginning = str;
word->length = 0;
p = word->beginning;
- while (*p && (!gdk_iswspace (*p)))
+ while (*p && !gdk_iswspace (*p))
{
word->length++;
p++;
}
word->width = gdk_text_width_wc (GTK_WIDGET (label)->style->font, str, word->length);
-
+
str += word->length;
if (*str)
- str++;
+ str++;
line_width += word->space + word->width;
-
+
*tailp = word;
tailp = &word->next;
}
-
+
return MAX (line_width, max_line_width);
}
-/*
- * gtk_label_pick_width
+/* gtk_label_pick_width
*
* Split paragraphs, trying to make each line at least min_width,
* and trying even harder to make each line no longer than max_width.
* short final line.)
*/
static gint
-gtk_label_pick_width (GtkLabel * label, gint min_width, gint max_width)
+gtk_label_pick_width (GtkLabel *label,
+ gint min_width,
+ gint max_width)
{
GtkLabelWord *word;
gint width, line_width;
g_return_val_if_fail (label->wrap, min_width);
-
+
line_width = 0;
width = 0;
for (word = label->words; word; word = word->next)
}
line_width += word->space + word->width;
}
-
+
return MAX (width, line_width);
}
-/*
- * Here, we finalize the lines.
+/* Here, we finalize the lines.
* This is only for non-wrap labels. Wrapped labels
* use gtk_label_finalize_wrap instead.
*/
static void
-gtk_label_finalize_lines (GtkLabel * label, gint line_width)
+gtk_label_finalize_lines (GtkLabel *label,
+ gint line_width)
{
- GtkLabelWord * line;
+ GtkLabelWord *line;
gint y, baseline_skip, y_max;
gint i, j;
gchar *ptrn;
line->y = y + GTK_WIDGET (label)->style->font->ascent + 1;
y_max = 0;
-
+
/* now we deal with the underline stuff; */
- if (ptrn && (ptrn[0] != '\0'))
+ if (ptrn && ptrn[0] != '\0')
{
- for (i=0;i<line->length;i++)
+ for (i = 0; i < line->length; i++)
{
if (ptrn[i] == '\0')
break;
gint width;
gint offset;
GtkLabelULine *uline;
-
- for (j=i+1;j<line->length;j++)
+
+ for (j = i + 1; j < line->length; j++)
{
if (ptrn[j] == '\0')
break;
else if (ptrn[j] == ' ')
break;
}
- /*
- * good. Now we have an underlined segment.
+
+ /* good. Now we have an underlined segment.
* let's measure it and record it.
*/
offset = gdk_text_width_wc (GTK_WIDGET (label)->style->font,
/* this finalizes word-wrapped words */
static void
-gtk_label_finalize_lines_wrap (GtkLabel * label, gint line_width)
+gtk_label_finalize_lines_wrap (GtkLabel *label,
+ gint line_width)
{
GtkLabelWord *word, *line, *next_line;
GtkWidget *widget;
}
gtk_label_finalize_lines_wrap (label, label->max_width);
}
- else if (label->words == 0)
+ else if (label->words == NULL)
{
label->max_width = gtk_label_split_text (label);
gtk_label_finalize_lines (label, label->max_width);
-
}
if (requisition != &widget->requisition)
{
misc = GTK_MISC (widget);
- g_return_val_if_fail ((label->words != NULL), FALSE);
-
/*
* GC Clipping
*/
gint
gtk_main_iteration (void)
{
- return g_main_iteration (TRUE);
+ if (main_loops)
+ {
+ g_main_iteration (TRUE);
+
+ return !g_main_is_running (main_loops->data);
+ }
+ else
+ return TRUE;
}
gint
gtk_main_iteration_do (gboolean blocking)
{
- return g_main_iteration (blocking);
+ if (main_loops)
+ {
+ g_main_iteration (blocking);
+
+ return !g_main_is_running (main_loops->data);
+ }
+ else
+ return TRUE;
}
void